package org.soc.timesheet.domain.repository;
import java.util.List;
import org.soc.timesheet.domain.SubProjects;
import org.soc.timesheet.domain.UsersProject;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.roo.addon.layers.repository.jpa.RooJpaRepository;
import org.springframework.stereotype.Repository;

@Repository
@RooJpaRepository(domainType = UsersProject.class)
public interface UsersProjectRepository extends JpaSpecificationExecutor<UsersProject>, JpaRepository<UsersProject, String> {
	
	@Query("select up from UsersProject up where up.idSubProject.id=?")
	public List<UsersProject> findByIdSubProject(int id);
	
	@Query("delete from UsersProject up where up.idSubProject.id=?1")
	@Modifying
	public void deleteBySubProject(int  id); 

}
